/* --------------------------------------------------------
 * Copyright (c) aeky , Inc.  All rights reserved.
 * --------------------------------------------------------
 */
package com.aeky.server.rpcservice;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.aeky.client.rpcservice.UserRPCService;
import com.aeky.domain.User;
import com.aeky.model.BaseMapData;
import com.aeky.server.service.IUserService;
import com.aeky.server.utils.RecordUtil;

/**
 * 
 * @author aeky
 */
@Service("userRpc")
public class UserRPCServiceImpl implements UserRPCService {

    @Autowired
    private IUserService userService;

    /*
     * 
     * @see com.aeky.client.rpcservice.UserRPCService#findAllUser()
     */
    @Override
    public BaseMapData findAllUser() {
        List<Map<String, Object>> userMapList = new ArrayList<Map<String, Object>>();
        List<User> userList = userService.findAllUser();
        for (User user : userList) {
            Map<String, Object> userMap = RecordUtil.createBaseModelData(user, "department;userDetail;userSetting;");
            userMapList.add(userMap);
        }
        BaseMapData data = new BaseMapData();
        data.put("userMapList", userMapList);
        return data;
    }

}
